// src/router/index.ts
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Home from '../components/Home.vue'
import BusinessList from '../components/BusinessList.vue'
import BusinessInfo from '../components/BusinessInfo.vue'
import Discover from '../components/Discover.vue'
import OrderList from '../components/OrderList.vue'
import Payment from '../components/Payment.vue'
import Login from '../components/Login.vue'
import Register from '../components/Register.vue'
import Order from "../components/Order.vue"

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/business-list',
    name: 'BusinessList',
    component: BusinessList
  },
  {
    path: '/business/:id',
    name: 'BusinessInfo',
    component: BusinessInfo,
    props: true
  },
  {
    path: '/discover',
    name: 'Discover',
    component: Discover
  },
  {
    path: '/orderList',
    name: 'OrderList',
    component: () => import('../components/OrderList.vue')
  },
  {
    path: '/payment',
    name: 'Payment',
    component: Payment,
    props: route => ({ orderId: route.query.orderId })
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
  {
    path:'/Order',
    name:'Order',
    component: Order
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router